package com.xm9m.web.service.internal.util;

import com.xm9m.web.service.api.response.common.SimpleResponse;
import com.xm9m.web.service.constants.StatusCode;

/**
 * Created by Liutong on 1/18/16.
 */
public class BuildResponseUtil {

    /**
     *
     * @param statusCode
     * @return
     */
    public static SimpleResponse buildSimpleResponse(StatusCode statusCode){
        SimpleResponse simpleResponse = new SimpleResponse();
        simpleResponse.setCode(statusCode.getCode());
        simpleResponse.setMessage(statusCode.getMessage());
        if (statusCode.getCode() == 200){
            simpleResponse.setSuccessful(true);
        } else {
            simpleResponse.setSuccessful(false);
        }
        return simpleResponse;
    }
}
